#include <glib.h>

static void _string_vprintf (GString *string, const gchar *format, ...)
{
  va_list args;

  va_start (args, format);
  g_string_vprintf (string, format, args);
  va_end (args);
}

static void _string_append_vprintf (GString *string, const gchar *format, ...)
{
  va_list args;

  va_start (args, format);
  g_string_append_vprintf (string, format, args);
  va_end (args);
}

gint main(gint argc, gchar **argv)
{
    GString *string;

    string = g_string_new("hello");

    g_print("string: %s \n", string->str);

    g_string_printf(string, "new str %s %d", "world", 100);

    g_print("printf string: %s \n", string->str);

    g_string_append_printf(string, "%s %s %d", "==", "append str", 200);

    g_print("append printf string: %s \n", string->str);

    _string_vprintf(string, "%s %d", "foo", 300);

    g_print("vprintf string: %s \n", string->str);

    _string_append_vprintf(string, "%s %d", "-append vprintf ", 400);

    g_print("append vprintf string: %s \n", string->str);

    g_string_free(string, TRUE);

    return 0;
}
